// Copyright 2021 Guoyoko. All Rights Reserved.


#include "Actions/CustomizeFlowActions.h"
#include "Asset/CustomizeFlowAsset.h"
#include "Toolkits/CustomizeFlowEditorToolkit.h"


#define LOCTEXT_NAMESPACE "CustomizeFlowActions"

FCustomizeFlowActions::FCustomizeFlowActions()
{
}

FText FCustomizeFlowActions::GetName() const
{
	return LOCTEXT("FCustomizeFlowActionsName", "CustomizeFlow");
}

FColor FCustomizeFlowActions::GetTypeColor() const
{
	return FColor(129, 196, 115);
}

void FCustomizeFlowActions::OpenAssetEditor(const TArray<UObject*>& InObjects, TSharedPtr<class IToolkitHost> EditWithinLevelEditor)
{
	//FSimpleAssetEditor::CreateEditor(EToolkitMode::Standalone, EditWithinLevelEditor, InObjects);

	const EToolkitMode::Type Mode = EditWithinLevelEditor.IsValid() ? EToolkitMode::WorldCentric : EToolkitMode::Standalone;

	for (auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
	{
		if (UCustomizeFlowAsset* Asset = Cast<UCustomizeFlowAsset>(*ObjIt))
		{
			TSharedRef<FCustomizeFlowEditorToolkit> EditorToolkit(new FCustomizeFlowEditorToolkit());
			EditorToolkit->Initialize(Mode, EditWithinLevelEditor, Asset);
		}
	}

}

UClass* FCustomizeFlowActions::GetSupportedClass() const
{
	return UCustomizeFlowAsset::StaticClass();
}

uint32 FCustomizeFlowActions::GetCategories()
{
	return EAssetTypeCategories::Type::Basic;
}

//////////////////////////////////////////////////////////////////////////

#undef LOCTEXT_NAMESPACE